package com.shioirikukuri.controller;

import com.shioirikukuri.entity.ReservationServiceRel;
import com.shioirikukuri.service.IReservationServiceRelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/reservation-service-rels")
public class ReservationServiceRelController {

	@Autowired
	private IReservationServiceRelService reservationServiceRelService;

	@GetMapping
	public List<ReservationServiceRel> getAllReservationServiceRels() {
		return reservationServiceRelService.getAllReservationServiceRels();
	}

	@GetMapping("/{relId}")
	public ReservationServiceRel getReservationServiceRelById(@PathVariable Integer relId) {
		return reservationServiceRelService.getReservationServiceRelById(relId);
	}

	@PostMapping
	public void createReservationServiceRel(@RequestBody ReservationServiceRel reservationServiceRel) {
		reservationServiceRelService.createReservationServiceRel(reservationServiceRel);
	}

	@PutMapping("/{relId}")
	public void updateReservationServiceRel(@PathVariable Integer relId, @RequestBody ReservationServiceRel reservationServiceRel) {
		reservationServiceRelService.updateReservationServiceRel(reservationServiceRel);
	}

	@DeleteMapping("/{relId}")
	public void deleteReservationServiceRelById(@PathVariable Integer relId) {
		reservationServiceRelService.deleteReservationServiceRelById(relId);
	}
}